package es

import (
	"github.com/olivere/elastic/v7"
)

//  -------------------------------------------- Should -------------------------------------------
// Term in Should
func (m *Model) ShouldTerm(fieldName string, value interface{}) *Model {
	return m.AddShould(elastic.NewTermQuery(fieldName, value))
}

// Terms in Should
func (m *Model) ShouldTerms(fieldName string, values ...interface{}) *Model {
	return m.AddShould(elastic.NewTermsQuery(fieldName, values...))
}

// Match in Should
func (m *Model) ShouldMatch(fieldName string, value interface{}) *Model {
	return m.AddShould(elastic.NewMatchQuery(fieldName, value))
}

// MatchPhrase in Should
func (m *Model) ShouldMatchPhrase(fieldName string, value interface{}) *Model {
	return m.AddShould(elastic.NewMatchPhraseQuery(fieldName, value))
}

// Range in Should
func (m *Model) ShouldRange(fieldName string, rangeOptions ...RangeOption) *Model {
	r := elastic.NewRangeQuery(fieldName)
	for _, rangeOption := range rangeOptions {
		rangeOption(r)
	}
	return m.AddShould(r)
}

// Exist in Should
func (m *Model) ShouldExist(fieldName string) *Model {
	return m.AddShould(elastic.NewExistsQuery(fieldName))
}
